export { }
let app = getApp<IAppOption>()
Page({
  data: {
    ip: '',
    ipQueryInfo: {
      Province: "",
      Country: "",
      City: "",
      Isp: ""
    }
  },
  onLoad() {
    wx.request({
      url: 'http://ip-api.com/json',
      success:  (res:any)=> {
        this.setData({
          ip:res.data.query
        })
      }
    })
  },
  inputChange(e: any) {
    this.setData({
      ip: e.detail.value
    })
  },
  searchHandle() {
    app.$request('ip', {
      ip: this.data.ip
    }).then((res: any) => {
      res.ip = this.data.ip
      this.setData({
        ipQueryInfo: res.result
      })
    })
  }
})

